﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NCLCustomerManagement.DataAccess.Sale;

namespace NCLCustomerManagement.BusinessLogic.Sale
{
    public class SaleBC : ISaleBC
    {
        private ISaleRepository _repo;
       

        public SaleBC(ISaleRepository repo)
        {
            _repo = repo;
        }
        public IEnumerable<DataTransferObjects.Sale.SaleDTO> GetSaleList(DateTime fromDate, DateTime toDate, string customerPhone, int? productId = null, int? categoryId = null)
        {
            return _repo.GetSaleList(fromDate, toDate, customerPhone, productId, categoryId)
                .ToList();
        }


        public void AddNewSaleItem(DataTransferObjects.Sale.SaleDTO dto)
        {
                        
            _repo.AddSaleItem(dto);
        }

        public void DeleteSaleItem(Guid id)
        {
            _repo.DeleteSaleItem(id);
        }




        public void DeleteSaleItem(params Guid[] id)
        {
            foreach (var item in id)
            {
                _repo.DeleteSaleItem(item);
            }
        }


        public DataTransferObjects.Sale.SaleDTO GetSaleItem(Guid id)
        {
            return _repo.GetSaleItem(id);
        }
    }
}
